/*
 * Main.cpp
 *
 *  Created on: Apr 10, 2010
 *      Author: stefan
 */

/*
 * Main.cpp
 *
 *  Created on: Apr 8, 2010
 *      Author: stefan
 */
#include "scanner/Automat1.h"
#include "scanner/Scanner.h"
#include "token/token.h"
#include "hashtabelle/SymtabEntry.h"
#include "buffer/buffer.h"
#include "hashtabelle/Symtable.h"
#include <iostream>

using namespace std;

int main() {

	Buffer* a;
	Symtable<char*>* table = new Symtable<char*> ();

	a = new Buffer("C:\\Users\\Florian Gref\\Documents\\Studium\\IB 3\\Systemnahes Programmieren\\text6.txt",
			"C:\\Users\\Florian Gref\\Desktop\\out.txt");

	Scanner* scaner = new Scanner(a);
	token* tokken;

	while (!a->endOfFileNear) {

		tokken = scaner->nextToken();

		if (tokken != 0) {
			if (tokken->getTyp() == TOKEN_IDENTYFIER) {
				table->add(tokken->getLexem(), tokken->getTyp());
			}
			if (tokken->getTyp() == TOKEN_INTEGER){
				a->writeTokentypeToFile(tokken->getTyp(), tokken->getLine(),
										tokken->getColumn(), tokken->getWert());
			}
			else{
				a->writeTokentypeToFile(tokken->getTyp(), tokken->getLine(),
														tokken->getColumn(), tokken->getLexem());
			}
		}

	}
	// table->ausgabe();
}
